<?php
require_once(dirname(__FILE__) . '/config.php'); ?>

<?php if ($_SESSION['USERID'] == ''): ?>
	<?php require_once(ABSPATH . 'includes/login.php');?>
<?php else: ?>
	<?php require_once(ABSPATH . 'includes/functions.php');?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<title>BaseApp</title>

			<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
			<link rel="stylesheet" type="text/css" media="screen" href="media/css/reset/reset.css" />
			<!--[if IE]>
				<link rel="stylesheet" type="text/css" media="screen" href="css/reset/ie.css" />
			<![endif]-->

			<?php echo GetJs();?>
			<?php echo GetCss();?>
			
			<style>
            #news{
            	display: block;
            	position: fixed !important;
            	bottom: 10px !important;
            	right: 10px !important;
            	background: #DB3340;
            	width: 200px;
            	height: 40px;
            	border-radius:3px;
            	color: #E8B71A;
            	text-align:center;
            }
            #news span{
            	display: block;
            	padding-top: 7px;
            }
			#news_s{
            	display: block;
            	position: fixed !important;
            	bottom: 100px !important;
            	right: 10px !important;
            	background: #DB3340;
            	width: 200px;
            	height: 40px;
            	border-radius:3px;
            	color: #E8B71A;
            	text-align:center;
            }
            #news_s span{
            	display: block;
            	padding-top: 7px;
            }
            #news_action{
            	display: block;
            	position: fixed !important;
            	bottom: 55px !important;
            	right: 10px !important;
            	background: #DB3340;
            	width: 200px;
            	height: 40px;
            	border-radius:3px;
            	color: #E8B71A;
            	text-align:center;
            }
            #news_action span{
            	display: block;
            	padding-top: 7px;
            }
            </style>

			<script type="text/javascript">
				$(document).ready(function (){
					AjaxSetup();
					$(document).on("click", ".logout", function () {
						var buttons = {							
					        	"done": {
						            text: "დადასტურება",
						            id: "done_id",
						            click: function () {
						            	

						            	var tabel_id = $("#tabel_id").val();
						            	if(tabel_id!=0){
						            	$.ajax({
									        url: "server-side/logout.action.php",
										    data: "act=logout_save&tabel_id="+tabel_id,
									        success: function(data) {
									        	window.location.href="index.php?act=logout";
										    }
									    });
						            	$(this).dialog("close");
						            	}else{
						            		alert('აირჩიეთ ქმედება!');
						            	}
						            }
						        }
						    };
						GetDialog("logout_dialog", "auto", "auto",buttons);
						$.ajax({
					        url: "server-side/logout.action.php",
						    data: "act=logout",
					        success: function(data) {
					        	  $("#logout_dialog").html(data.page);
						    }
					    });
			        });
				});


				 
			         
			            $(document).ready(function (){
			            	checker();
			                function checker(){
			                	setTimeout(function(){
			                		$.ajax({
			        		            url: "checker.php",
			        		            type: "POST",
			        		            data: "act=get_checker",
			        		            dataType: "json",
			        		            success: function (data) {
			      		            	   $( "#newsmain" ).html(data.count);
			        		            }
			        		        });
			                		checker();
			                    	}, 3000);
			                }
							
							$(document).on("click", "#news", function () {
								location.href='index.php?pg=13#tab-1';
							});
							$(document).on("click", "#news_action", function () {
								location.href='index.php?pg=12#tab-1';
							});
							$(document).on("click", "#news_s", function () {
								location.href='index.php?pg=12';
							});
						});
			       
			</script>
		</head>
		<body style="background: #E2F0FD url(media/images/bg.png);">
			<div id="npm"></div>
			<?php require_once(ABSPATH . 'includes/pages.php'); ?>
			<div class="clear high"></div>
			<div id="newsmain">
			
			</div>
		</body>
		
		<!-- jQuery Dialog -->
    	<div id="logout_dialog" title="ქმედება">
    	</div>
	</html>
<?php endif;?>